package com.dd.stack.es.pojo.es;

import com.dd.stack.common.util.annotation.Explanation;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * @Author liuxianmeng
 * @CreateTime 2025/4/20 23:58
 * @Description PersonESDO 实体类，表示一个包含基本详细信息和地址信息的人员
 */
@Data
@Explanation("PersonESDO 实体类，表示一个包含基本详细信息和地址信息的人员")
@Document(indexName = "person")
public class PersonESDO {
    @Id
    @Explanation("唯一标识符")
    private String id;
    @Field(type = FieldType.Text)
    @Explanation("人员的姓名")
    private String name;
    @Field(type = FieldType.Integer)
    @Explanation("人员的年龄")
    private Integer age;
    @Field(type = FieldType.Float)
    @Explanation("人员的身高（单位：米）")
    private Float height;
    @Field(type = FieldType.Date)
    @Explanation("人员的出生日期")
    private LocalDate birthDate;
    @Field(type = FieldType.Object)
    @Explanation("人员的地址信息")
    private Address address;
    @Field(type = FieldType.Date)
    @Explanation("人员记录的创建时间")
    private LocalDateTime createdAt;

    @Data
    public static class Address {
        @Field(type = FieldType.Text)
        @Explanation("地址的街道名称")
        private String street;
        @Field(type = FieldType.Integer)
        @Explanation("地址的邮编")
        private Integer zipCode;
        @Field(type = FieldType.Object)
        @Explanation("地址的坐标信息")
        private Coordinates coordinates;
    }

    @Data
    public static class Coordinates {
        @Field(type = FieldType.Float)
        @Explanation("地址的纬度坐标")
        private Float latitude;
        @Field(type = FieldType.Float)
        @Explanation("地址的经度坐标")
        private Float longitude;
        @Field(type = FieldType.Text)
        @Explanation("描述")
        private String description;
        @Field(type = FieldType.Integer)
        @Explanation("测试数字类型")
        private Integer testNum;
    }
}